package com.ywu.file.sys.standard.api;

import com.ywu.common.result.CommonResult;
import com.ywu.file.sys.standard.dto.YwuFileAppPermissionDto;
import com.ywu.file.sys.standard.entity.YwuFileAppPermissionEntity;
import com.ywu.file.sys.standard.service.YwuFileAppPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName YwuFileAppPermissionApi
 * @Description TODO
 * @Author GroundDemo
 * @Date 2024/8/15 19:35
 * @Version 1.0
 **/
@RestController
@RequestMapping("/ywu/file/sys/permission")
public class YwuFileAppPermissionApi {
    @Autowired
    private YwuFileAppPermissionService service;

    /**
    * @Author GroundDemo
    * @Description 分页查询授权信息
    * @Date 19:38 2024/8/15
    * @Param []
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/ywu.fss.permission.query.list")
    public CommonResult<Object> queryPageList(@RequestBody YwuFileAppPermissionDto dto) {
        return service.queryPageList(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 添加授权映射
    * @Date 19:41 2024/8/15
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/ywu.fss.permission.add.info")
    public CommonResult<Object> addPermissionInfo(@RequestBody YwuFileAppPermissionDto dto) {
        return service.addPermissionInfo(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 删除授权关系
    * @Date 19:47 2024/8/15
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/ywu.fss.permission.delete.info")
    public CommonResult<Object> deletePermissionInfo(@RequestBody YwuFileAppPermissionDto dto) {
        return service.deletePermissionInfo(dto);
    }

    /**
    * @Author GroundDemo
    * @Description 根据AppId查询授权列表
    * @Date 19:50 2024/8/15
    * @Param [dto]
    * @return com.ywu.common.result.CommonResult<java.util.List<com.ywu.file.sys.standard.entity.YwuFileAppPermissionEntity>>
    **/
    @PostMapping("/ywu.fss.permission.query.for.spi")
    public CommonResult<List<YwuFileAppPermissionEntity>> getPermissionByAppId(@RequestBody YwuFileAppPermissionDto dto) {
        return service.getPermissionByAppId(dto);
    }
}
